public class Demo {
    public static void main(String[] args) {
        Thread t = new Thread(()->{
            for (int i = 0; i < 5; i++) {
                System.out.println("still alive!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("I'm going to die");
        });

        System.out.println(t.getName()+" ID: "+t.getId());
        System.out.println(t.getName()+" 状态: "+t.getState());
        System.out.println(t.getName()+" 优先级: "+t.getPriority());
        System.out.println(t.getName()+" 后台: "+t.isDaemon());
        System.out.println(t.getName()+" 存活: "+t.isAlive());
        System.out.println(t.getName()+" 中断: "+t.isInterrupted());

        t.start();
        System.out.println("die? --> 100%");
        System.out.println(t.getName()+" 状态: "+t.getState());
    }
}
